#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define ll long long
#define fi first
#define se second
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb LDINF = 9128739847123.00;
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;

ll l, r;

void load()
{
	cin >> l >> r;
}

vector <ll> all;


void solve()
{
	for (int i = 1; i <= 10; i++)
	{
		for (int j = 0; j < (1 << i); j++)
		{
			ll num = 0;
			for (int k = 0; k < i; k++)
			{
				if (j & (1 << k))
					num = num * 10 + 4;
				else num = num * 10 + 7;
			}
			all.pb(num);
		}
	}
	sort(all.begin(), all.end());
	int pos1 = 0;
	int pos2 = 0;
	for (; pos1 < all.size() && all[pos1] < l; pos1++);
	for (; pos2 < all.size() && all[pos2] <= r; pos2++);
	if (pos1 >= pos2)
	{
		cout << all[pos2] * (r - l + 1);
		return;
	}
//	cerr << pos1 << " " << pos2 << "\n";
//	cerr << all[pos1] - l + 1 << " " << all[pos1] << "\n";
	ll res = ((ll)all[pos1] - l + 1) * (ll)all[pos1];
//	cerr << all[pos1] << "\n";
	res += (r - all[pos2 - 1]) * all[pos2];
//	cerr << res << "\n";
//	cerr << r - all[pos2 - 1] << " " << all[pos2] << "\n";
	for (int i = pos1; i < pos2 - 1; i++)
	{
		res += (all[i + 1] - all[i]) * all[i + 1];
	}
	cout << res;
}

#define file "a"
int main()
{
	#ifndef ONLINE_JUDGE
		freopen(file".in", "rt", stdin);
		freopen(file".out", "wt", stdout);
	#endif
	load();
	solve();
	return 0;
}
